{% extends "base.html" %}
{% set active_page = "leaderboard" %}
{% set page_title = "Leaderboard - See biggest miners" %}
{% block body %}
<script>
$(document).ready(function() {
    $("#roundSummary").tablesorter({
      textExtraction: function(node) {
        var attr = $(node).attr('data-sort-value');
        if (typeof attr !== 'undefined' && attr !== false) {
          return attr;
        }
        return $(node).text(); 
      } 
    });
});
</script>
<div class="row page-header">
  <h2>{{ _("Top Hashers") }}</h2>
  <br>
  <div class="col-lg-12">
    <table class="table table-striped table-hover table-responsive tablesorter" id="roundSummary">
      <thead>
        <tr>
          <th>{{ _("User") }}</th>
          {% for disp, algo in algos %}
          <th>{{ disp }} {{ _("Hashrate") }}</th>
          {% endfor %}
        </tr>
      </thead>
      <tbody>
      {% for user, data in users %}
        <tr>
          <th>{{ loop.index }}.
            {% if user == "Anonymous" %}
              {{ user }}
            {% else %}
              <a href="/stats/{{ user }}">{{ user }}</a>
            {% endif %}
          </th>
          {% for disp, algo in algos %}
          {% set dat = data.get(algo, 0) %}
          <td data-sort-value="{{ dat }}">{% if dat %}{{ dat | hashrate }}{% endif %}</td>
          {% endfor %}
        </tr>
      {% else %}
      <tr>
        <td colspan="{{ algos | length + 1 }}">{{ _("No users to show hashrates for!") }}</td>
      </tr>
      {% endfor %}
      </tbody>
    </table>
  </div>
</div>
{% endblock %}
